package cn.emall.config;


import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;

import org.springframework.stereotype.Component;
import utils.MailUtil;

/**
 * 异步发送邮箱验证码
 * @author lyw
 */
@Component
public class AsyncEmail {
    @Async
    public void testMail(String email, RedisTemplate<String,String> redisTemplate){
        Integer code =(int)(Math.random()*100000);
        MailUtil.sendEmail(email,code.toString(),redisTemplate);
        /*try{
            Thread.sleep(1000);
        }catch (Exception e){
            e.printStackTrace();
        }*/

    }
}
